<script>
	export default {
	onLaunch: function() {
		uni.getSystemInfo({
			success: e=> {
				this.initSize(e);
			}
		})
		// #ifdef MP-WEIXIN
		this.wxUpdata(); //小程序更新
		// #endif  
	},
	methods:{
		/**
		 * 存储设备信息
		 * @param {Object} 
		 */
		initSize(e){
			const systemInfo = e;
			let navigationBarHeight;
			let custom = {};
			// #ifndef MP
			custom = {height: 36,width: 88};
			navigationBarHeight = 44;
			// #endif
			// #ifdef MP-WEIXIN
			custom = wx.getMenuButtonBoundingClientRect();
			navigationBarHeight = custom.bottom + custom.top - e.statusBarHeight * 2;
			// #endif
			systemInfo.custom = custom;
			systemInfo.navigationBarHeight = navigationBarHeight;
			Vue.prototype.systemInfo = systemInfo;
		},
		wxUpdata() {
			const updateManager = uni.getUpdateManager();
			updateManager.onCheckForUpdate((res) => {
				// 请求完新版本信息的回调
			});
			updateManager.onUpdateReady((res) => {
				uni.showModal({
					title: '更新提示',
					content: '新版本已经准备好，是否重启应用？',
					success: (res) => {
						if (res.confirm) {
							updateManager.applyUpdate();
						}
					}
				});
			});
			updateManager.onUpdateFailed((res) => {
				uni.showModal({
					title: '已经有新版本喽~',
					content: '请您删除当前小程序，到微信 “发现-小程序” 页，重新搜索打开哦~',
					success: (res) => {
						if (res.confirm) {
		
						}
					}
				});
			});
		}
	},
	onHide: function() {
		console.log('App Hide')
	}
	}
</script>

<style>
	/*每个页面公共css */
	@import url("styles/mian.css");
</style>
